var charsview = {
	showInOutData: function() {
		let option = {
			title: {
				text: ''
			},
			tooltip: {},
			legend: {
				data: ['出入库']
			},
			xAxis: {
				data: ["入库", "出库"],
				axisLine: { //坐标线
					show: true
				},
				axisTick: { //隐藏刻度线
					show: false
				},
			},
			yAxis: {
				show: false
			},
			series: [{
				// name: '出入库',
				type: 'bar',
				data: [vue.inSize, vue.outSize],
				itemStyle: {
					normal: {
						// item点的颜色。
						// color: '#00dffc',//全部设置相同颜色
						color: function(params) {
							let color = ["#FFCCCCbb", "#00dffcbb"]; //颜色组
							return color[params.dataIndex];
						},
						label: { //显示每个值 lebel
							show: true,
							position: 'top', //在上方显示
							textStyle: {
								color: '#00dffc',
								fontSize: 16
							}
						}
					},
				}
			}]
		};
		vue.inOutWareChar.setOption(option);
	},
	//饼图的出入库
	showCirleChars: function() {
		let option = {
			// tooltip: {
			//     trigger: 'item'
			// },
			//  legend: {
			// show:false,
			//      top: '5%',
			//      left: 'center'
			//  },
			series: [{
				// name: '访问来源',
				radius: ['30%', '80%'],
				type: 'pie',
				// radius: [10, 20], 
				// center: ['50%', '50%'],
				avoidLabelOverlap: false,
				// roseType: 'area',//南丁格尔图
				itemStyle: {
					normal: {
						color: function(params) {
							let color = ["#FFCCCCbb", "#00dffcbb"]; //颜色组
							return color[params.dataIndex];
						},
					}
				},
				// itemStyle: {
				//     borderRadius: 10,
				//     borderColor: '#fff',
				//     borderWidth: 2
				// },
				label: {
					show: false,
					position: 'center'
				},
				emphasis: {
					label: {
						show: false,
						fontSize: '40',
						fontWeight: 'bold'
					}
				},
				labelLine: {
					show: false
				},
				data: [{
						value: vue.inSize,
						name: '入库'
					},
					{
						value: vue.outSize,
						name: '出库'
					},
				]
			}]
		};
		vue.circleChar.setOption(option);
	},
	showPowerChar: function() {
		let pow = vue.BlueToothPower == "待查询" ? 0 : vue.BlueToothPower + 1;
		let option = {
			series: [{
				radius: ['30%', '80%'],
				type: 'pie',
				avoidLabelOverlap: false,
				itemStyle: {
					normal: {
						color: function(params) {
							let color = ["#FFA500bb", "#8134afcc"]; //颜色组
							return color[params.dataIndex];
						},
					}
				},
				label: {
					show: false,
					position: 'center'
				},
				emphasis: {
					label: {
						show: false,
						fontSize: '40',
						fontWeight: 'bold'
					}
				},
				labelLine: {
					show: false
				},
				data: [{
						value: pow,
						name: '当前功率'
					},
					{
						value: 6,
						name: '总功率'
					},
				]
			}]
		};
		vue.powerchar.setOption(option);



	},
	showPinlvChar: function() {
		let option = {
			series: [{
				radius: ['30%', '80%'],
				type: 'pie',
				avoidLabelOverlap: false,
				itemStyle: {
					normal: {
						color: function(params) {
							let color = ["#7ebc59bb", "#fce014bb"]; //颜色组
							return color[params.dataIndex];
						},
					}
				},
				label: {
					show: false,
					position: 'center'
				},
				emphasis: {
					label: {
						show: false,
						fontSize: '40',
						fontWeight: 'bold'
					}
				},
				labelLine: {
					show: false
				},
				data: [{
						value: vue.readCard,
						name: '当前频率'
					},
					{
						value: 1000,
						name: '总频率'
					},
				]
			}]
		};
		vue.pinlvchar.setOption(option);
	},

	refrechar: function() {
		charsview.showInOutData();
		charsview.showCirleChars();
		charsview.showPowerChar();
		charsview.showPinlvChar();


	},

	loadjson: function(callback) {
		const that = this;
		var xhr = new XMLHttpRequest();
		xhr.open("GET", "../js/china.json", true);
		xhr.send();
		xhr.onreadystatechange = function() {
			if (xhr.readyState == 4 && xhr.status == 200) {
				callback(JSON.parse(xhr.responseText));
			}
		}
	},

	showChinaMap: function() {
		charsview.loadjson((res) => {
			// vue.chinamap.registerMap('china', res);
			let option = {
				tooltip: { //不显示提示标签
					show: false
				},
				 
				series: [{
					type: "map",
					map: "china",
					roam: false,
					zoom: 1.23,
					center: [105, 36],
					// geoIndex: 1,
					// aspectScale: 0.75, //长宽比
					showLegendSymbol: false, // 存在legend时显示
					label: { //省会名称
						normal: {
							show: true, //是否显示
							textStyle: {
								color: "#ffffffaa"
							}
						},
						emphasis: {
							show: true,
							textStyle: {
								color: "#ff00ff"
							}
						}
					},
					itemStyle: {
						normal: { //未选中状态
							areaColor: "#1ec0ffaa", //内部颜色
							borderColor: "#1ec0ff", //边界线
							borderWidth: 0.5,
						}
					},
					data: [

						{
							name: '北京',
							selected: false,
							value: 1
						},
						{
							name: '天津',
							selected: false,
							value: 2
						},
						{
							name: '上海',
							selected: false,
							value: 3
						},
						{
							name: '重庆',
							selected: false,
							value: 4
						},
						{
							name: '河北',
							selected: false,
							value: 5
						},
						{
							name: '河南',
							selected: false,
							value: 6
						},
						{
							name: '云南',
							selected: false,
							value: 7
						},
						{
							name: '辽宁',
							selected: false,
							value: 8
						},
						{
							name: '黑龙江',
							selected: false,
							value: 9
						},
						{
							name: '湖南',
							selected: false,
							value: 10
						},
						{
							name: '安徽',
							selected: false,
							value: 11
						},
						{
							name: '山东',
							selected: false,
							value: 12
						},
						{
							name: '新疆',
							selected: false,
							value: 13
						},
						{
							name: '江苏',
							selected: false,
							value: 14
						},
						{
							name: '浙江',
							selected: false,
							value: 15
						},
						{
							name: '江西',
							selected: false,
							value: 16
						},
						{
							name: '湖北',
							selected: false,
							value: 17
						},
						{
							name: '广西',
							selected: false,
							value: 18
						},
						{
							name: '甘肃',
							selected: false,
							value: 19
						},
						{
							name: '山西',
							selected: false,
							value: 20
						},
						{
							name: '内蒙古',
							selected: false,
							value: 21
						},
						{
							name: '陕西',
							selected: false,
							value: 22
						},
						{
							name: '吉林',
							selected: false,
							value: 23
						},
						{
							name: '福建',
							selected: false,
							value: 24
						},
						{
							name: '贵州',
							selected: false,
							value: 25
						},
						{
							name: '广东',
							selected: false,
							value: 26
						},
						{
							name: '青海',
							selected: false,
							value: 27
						},
						{
							name: '西藏',
							selected: false,
							value: 28
						},
						{
							name: '四川',
							selected: false,
							value: 29
						},
						{
							name: '宁夏',
							selected: false,
							value: 30
						},
						{
							name: '海南',
							selected: false,
							value: 31
						},
						{
							name: '台湾',
							selected: false,
							value: 32
						},
						{
							name: '香港',
							selected: false,
							value: 33
						},
						{
							name: '澳门',
							selected: false,
							value: 34
						},
					]
				}]
			};
			vue.chinamap.setOption(option);
		})

	}




}
